﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Cvk.FAQs;

namespace BatDongSan.Modules
{
    public partial class Uc_FAQBox : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            GetFAQ();
        }
        private void GetFAQ()
        {
            try
            {
                List<Cvk_FQA> list = FAQBll.claFAQs.GetList(5, true, Utility.strConnect);
                if (list.Count > 0)
                {
                    rptFAQ.DataSource = list;
                    rptFAQ.DataBind();
                }
            }
            catch { }
        }
        protected void rptFAQ_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            try
            {
                if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
                {
                    Cvk_FQA info = (Cvk_FQA)e.Item.DataItem;
                    HyperLink hplSubject = (HyperLink)e.Item.FindControl("hplSubject");
                    hplSubject.Text = cvk.AppCode.WebUtility.CatString(info.Question, 10);
                    hplSubject.ToolTip = info.Question;
                    hplSubject.NavigateUrl = string.Format("/FQADetail.aspx?id={0}",  info.FQAId);
                    //hplSubject.NavigateUrl = string.Format("http://{0}/{1}/{2}/{3}.htm", Request.Url.Authority, NewsBll.claNewsTypeDetail.GetUrlFriendly(1, info.NewsTypeId, Utility.strConnect), info.NewsId, info.SeoUrl);
                }
            }
            catch { }
        }

        protected void btSendFAQ_Click(object sender, EventArgs e)
        {
            Response.Redirect("/FAQSend.aspx");
        }
    }
}